package com.example.concurrent.ArrayBlockingQueue;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

/**
 * Created by Administrator on 2017/2/10 0010.
 */
public class ArrayBlockingQueueDemo {
    public static void main(String[] args) {
        try {
            BlockingQueue queue = new ArrayBlockingQueue(1024);
            queue.put("1");
            queue.put("11");

            Object object = queue.take();
            System.out.println(object.toString());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        try {
            BlockingQueue<String> queue = new ArrayBlockingQueue<String>(1024);
            queue.put("2");
            queue.put("22");
            String string = queue.take();

            System.out.println(string);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
